﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMS.Chess.CommonLayer
{
    public class QueenMove : AMove
    {
        public QueenMove(AChessBoard board)
            : base(board)
        { }

        protected override List<ABoardPosition> GenerateMoves(AChessPiece movingPiece, ABoardPosition startPosition)
        {
            // valid position and valid piece/position match already verified with board

            StandardBoardPosition originalPosition = startPosition as StandardBoardPosition;
            if (originalPosition == null)
                throw new ArgumentException("Invalid position type");

            StandardChessBoard board = _board as StandardChessBoard;
            if (board == null)
                throw new ArgumentException("Invalid board");

            Console.WriteLine("A Queen moves forward, back, left, right, or along all four diagonals. QueenMove is generating possible positions.");

            // generate all possible up/down/left/right moves
            List<ABoardPosition> possibleMoves = new List<ABoardPosition>();
            RookMove.GenerateRookMoves(board, movingPiece, originalPosition, possibleMoves);
            BishopMove.GenerateBishopMoves(board, movingPiece, originalPosition, possibleMoves);

            return possibleMoves;
        }
    }
}
